﻿<Window x:Class="DatabaseManager.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Loaded="Window_Loaded"
        Title="Theme Editor" Height="455" Width="789"
        FontFamily="Consolas">
    <Window.Resources>
        <Style x:Key="ListViewStyle">
            <Setter Property="ListView.IsSynchronizedWithCurrentItem" Value="true"/>
            <Setter Property="ListView.ItemsSource" Value="{Binding}"/>
            <Setter Property="ListView.SelectionMode" Value="Single" />
        </Style>
        <Style x:Key="CurrentItemStyle">
            <Setter Property="TextBlock.HorizontalAlignment" Value="Center" />
            <Setter Property="TextBlock.Background" Value="Black" />
            <Setter Property="TextBlock.Foreground" Value="White" />
            <Setter Property="TextBlock.Padding" Value="3" />
        </Style>
        <Style x:Key="CenteredLabelStyle">
            <Setter Property="TextBlock.HorizontalAlignment" Value="Center" />
            <Setter Property="TextBlock.VerticalAlignment" Value="Center" />
            <Setter Property="TextBlock.Padding" Value="1" />
            <Setter Property="TextBlock.Margin" Value="1" />
        </Style>
        <Style x:Key="ActionButton">
            <Setter Property="Button.Margin" Value="3" />
            <Setter Property="Button.Padding" Value="3" />
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <ListView HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                  Grid.Column="1"
                  Name="ScheduleListView"
                  Style="{StaticResource ListViewStyle}"                  
                  Loaded="ScheduleListView_Loaded"
                  SelectionChanged="ScheduleListView_SelectionChanged"
                  DisplayMemberPath="FullName"/>
        <Grid MinWidth="300">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" Grid.Column="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <StackPanel Margin="3" Grid.Column="0" Grid.Row="0">
                    <TextBlock Style="{StaticResource CenteredLabelStyle}">
                        Class Types
                    </TextBlock>
                    <ListView  Name="ClassTypesListView"  
                               Style="{StaticResource ListViewStyle}"
                               DisplayMemberPath="Name" 
                               SelectionChanged="ClassTypesListView_SelectionChanged"/>
                </StackPanel>
                <StackPanel Margin="3" Grid.Column="1" Grid.Row="0">
                    <TextBlock Style="{StaticResource CenteredLabelStyle}">
                        Levels
                    </TextBlock>
                    <ListView Name="LevelsListView" 
                              Style="{StaticResource ListViewStyle}"                              
                              DisplayMemberPath="Name"
                              SelectionChanged="LevelsListView_SelectionChanged"/>
                </StackPanel>
                <StackPanel Margin="3" Grid.Column="2" Grid.Row="0">
                    <TextBlock Style="{StaticResource CenteredLabelStyle}">
                        Weeks
                    </TextBlock>
                    <ListView Name="WeeksListView"
                              Style="{StaticResource ListViewStyle}"                              
                              DisplayMemberPath="Name" 
                              SelectionChanged="WeeksListView_SelectionChanged"/>
                </StackPanel>
                <StackPanel Margin="3" Grid.Column="0" Grid.Row="1">
                    <TextBlock Style="{StaticResource CenteredLabelStyle}">
                        Class Type
                    </TextBlock>
                    <TextBlock Style="{StaticResource CurrentItemStyle}"
                               Text="{Binding ElementName=ClassTypesListView, Path=SelectedItem.Name}" />
                    <Button Margin="3" Click="NextClassType_Click">Next</Button>
                </StackPanel>
                <StackPanel Margin="3" Grid.Column="1" Grid.Row="1">
                    <TextBlock Style="{StaticResource CenteredLabelStyle}">
                        Level
                    </TextBlock>
                    <TextBlock Style="{StaticResource CurrentItemStyle}" 
                               Text="{Binding ElementName=LevelsListView, Path=SelectedItem.Name}" />
                    <Button Margin="3" Click="NextLevel_Click">Next</Button>
                </StackPanel>
                <StackPanel Margin="3" Grid.Column="2" Grid.Row="1">
                    <TextBlock Style="{StaticResource CenteredLabelStyle}">
                        Week
                    </TextBlock>
                    <TextBlock Style="{StaticResource CurrentItemStyle}"
                               Text="{Binding ElementName=WeeksListView, Path=SelectedItem.Name}" />
                    <Button Margin="3" Click="NextWeek_Click">Next</Button>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="1" Grid.Column="0" Margin="1 10">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Row="0" Grid.Column="0" 
                           HorizontalAlignment="Left"
                           Margin="2"
                           Style="{StaticResource CenteredLabelStyle}">
                    Current
                </TextBlock>
                <TextBox Grid.Row="0" Grid.Column="1"   
                         VerticalContentAlignment="Center"  
                         IsReadOnly="True"
                         Name="CurrentThemeTextBox"/>
                <TextBlock Grid.Row="1" Grid.Column="0" 
                           HorizontalAlignment="Left"
                           Margin="2"
                           Style="{StaticResource CenteredLabelStyle}">
                    Updated
                </TextBlock>
                <TextBox Grid.Row="1" Grid.Column="1"
                         VerticalContentAlignment="Center"  
                         TextChanged="UpdatedThemeTextBlock_TextChanged"
                         Name="UpdatedThemeTextBlock">
                    
                </TextBox>
            </Grid>
            <Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Button Grid.Row="0" Grid.Column="0" 
                        Style="{StaticResource ActionButton}"
                        Click="UpdateThenNextTheme_Click"
                        Name="UpdateAndNextThemeButton">
                    _Add/Next
                </Button>
                <Button Grid.Row="0" Grid.Column="1" 
                        Style="{StaticResource ActionButton}"
                        Click="NextTheme_Click"
                        Name="NextThemeButton">
                    _Next
                </Button>
                <Button Grid.Row="1" Grid.Column="0" 
                        Style="{StaticResource ActionButton}"
                        Click="UpdateTheme_Click"
                        Name="UpdateThemeButton">
                    A_dd
                </Button>                
                <Button Grid.Row="1" Grid.Column="1" 
                        Style="{StaticResource ActionButton}"
                        Click="RemoveTheme_Click"
                        Name="RemoveThemeButton">
                    _Remove
                </Button>

            </Grid> 
        </Grid>
    </Grid>

</Window>
